package CoteClient;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JTextField;
import javax.swing.SwingConstants;
import javax.swing.border.EmptyBorder;

public class VueAjoutContact extends Vue {

	private JPanel contentPane;
	private JTextField textFieldLogin;
	private JLabel lblPassword;
	private JPasswordField textFieldPassword;
	private JTextField textField;

	public VueAjoutContact(Controleur controleur) {
		
		super(controleur);
		setTitle("Ajouter Contact");
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 412, 198);
		
		JMenuBar menuBar = new JMenuBar();
		setJMenuBar(menuBar);
		
		JMenu mnErim = new JMenu("Menu");
		menuBar.add(mnErim);
		
		JMenuItem mntmAjouterContact = new JMenuItem("ajouter Contact");
		mnErim.add(mntmAjouterContact);
		
		JMenuItem mntmQuitter = new JMenuItem("Quitter");
		mnErim.add(mntmQuitter);
		
		JMenu mnStatut = new JMenu("Statut");
		menuBar.add(mnStatut);
		
		JMenuItem mntmDisponible = new JMenuItem("Disponible");
		mnStatut.add(mntmDisponible);
		mntmDisponible.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
//				getControleur().
			}
			});
		
		JMenuItem mntmOccup = new JMenuItem("Occupé");
		mnStatut.add(mntmOccup);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(null);
		
		JLabel lblProfile = new JLabel("Profile ");
		lblProfile.setHorizontalAlignment(SwingConstants.RIGHT);
		lblProfile.setBounds(87, 12, 61, 15);
		contentPane.add(lblProfile);
		
		textField = new JTextField();
		textField.setBounds(166, 10, 226, 19);
		contentPane.add(textField);
		textField.setColumns(10);
		
		JButton btnAjouter = new JButton("ajouter");
		btnAjouter.setBounds(166, 114, 107, 25);
		btnAjouter.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				getControleur().addContact(textField.getText());
			}
		});
		contentPane.add(btnAjouter);
		
		JButton btnAnnuler = new JButton("annuler");
		btnAnnuler.setBounds(285, 114, 107, 25);
		btnAnnuler.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				getControleur().lancerMenu();
			}
		});
		contentPane.add(btnAnnuler);
	}
}
